package com.cbhb.sys;

import java.util.HashSet;
import java.util.Set;

public class NumJewelsInStones {

    public static int numJewelsInStones(String jewels, String stones) {
        Set<Character> set = new HashSet<>();
        int num = 0;
        for(char cha : jewels.toCharArray()) {
            set.add(cha);
        }
        for (char cha : stones.toCharArray()) {
            if (set.contains(cha)) {
                num ++;
            }
        }
        return num;
    }

    public static void main(String[] args) {
        System.out.println(numJewelsInStones("aA", "aAAbbbb"));
    }
}
